import re

ENCODE_NAMES = {
    '&amp;': '&',
    '&lt;': '<',
    '&gt;': '>',
    '&quot;': '"',
    '&apos;': "'",
    '&#039;': "'",
    '&nbsp;': ' ',
}


def decode_name(str_: str = '') -> str:
    str_ = str_.strip()
    return re.sub(r'&amp;|&lt;|&gt;|&quot;|&apos;|&#039;|&nbsp;', lambda s: ENCODE_NAMES[s.group()], str_)

def format_duration(seconds):
    """Convert duration from seconds to MM:ss format."""
    seconds = int(seconds)
    minutes, seconds = divmod(seconds, 60)
    return f"{minutes:02d}:{seconds:02d}"